<?php include("includes/header.php"); ?>
<?php include("includes/generic_functions.php"); ?>
<?php
require_once('conn/db.php');
if (isset($_GET['id'])) {
    $blog_id = $_GET['id'];


    dbConnect();
    $query_rsblog = "SELECT * FROM blog_entries WHERE id = $blog_id LIMIT 1";

    $rsBlog = mysql_query($query_rsblog) or die(mysql_error());
    $row_rsBlog = mysql_fetch_assoc($rsBlog);

    $blog_id = $row_rsBlog['id'];
    $blog_type_id = $row_rsBlog['type_id'];
    $blog_content = $row_rsBlog['content'];
    $blog_title = $row_rsBlog['title'];
    $blog_date = $row_rsBlog['blog_date'];
    $blog_image = $row_rsBlog['image'];
    //exit();
//Get all the variables used on the page
    $atoms = explode('-', $blog_date);
    $blog_year = $atoms[0];
    $blog_month = $atoms[1];
    $blog_day = $atoms[2];
} else {
    header('Location: index.php');
}
?>
<div id="content">
    <div id="leftdiv">
        <?php if ($row_rsBlog > 0) { ?>
            <div class="blogentry">
                <div class="datetime">
                    <p class="month">
                        <?php GetMonthAbbreviationFromMonthNumber($blog_month); ?>
                    </p>
                    <p class="day">
                        <?php echo($blog_day); ?>
                    </p>
                    <p class="year">
                        <?php echo($blog_year); ?>
                    </p>
                </div>
                <div class="blogtext">
                    <h2>
                        <a href="#"><?php echo($blog_title);?></a></h2>
                    <img src="<?php echo "images/blog/$blog_image" ?>" alt="Smiley face" width="400"/>
                    <p>
                        <?php
                        echo(html_entity_decode($blog_content, ENT_COMPAT, 'iso-8859-1'));
                        ?>
                    </p>
                    <div class="fb-like" data-href="http://jamesklipp.com/oldweb" data-send="false" data-layout="button_count"
                         data-width="450" data-show-faces="true">
                    </div>
                </div>
                <div id="disqus_thread"></div>
                <script type="text/javascript">
                    /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
                    var disqus_shortname = 'jamesklippsblog'; // required: replace example with your forum shortname

                    /* * * DON'T EDIT BELOW THIS LINE * * */
                    (function() {
                        var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
                        dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
                        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
                    })();
                </script>
                <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
                <a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>

            </div>
<?php } ?>
    </div>
    <div id="rightdiv">
        <script type="text/javascript"><!--
            google_ad_client = "ca-pub-7711837146470912";
            /* Right Add */
            google_ad_slot = "5417268672";
            google_ad_width = 300;
            google_ad_height = 600;
            //-->
        </script>
        <script type="text/javascript"
                src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
        </script>
    </div>
</div>
<?php include("includes/footer.php"); ?>
